package com.huawei.eservice.uitls;


import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;

import java.io.File;


/**
 * @author young
 * @Desription 从.properties文件中读取相关测试数据<br>
 */
public class PropertiesDataProvider {

    public static String getTestData(String configFilePath, String key) {
        Configurations configs = new Configurations();
        Configuration config = null;
        try {
            config = configs.properties(new File(configFilePath));
        } catch (ConfigurationException cex) {
            // Something went wrong
        }
        return config.getString(key);

    }

    /*public static void main(String[] arg) {
        LogConfiguration.initLog("LoginPage");
        Configurations configs = new Configurations();
        Configuration config = null;
        try {
            File file = new File("app/src/main/res/properties/appName.properties");
            config = configs.properties(file);
            String app = config.getString("app");
            String ip = config.getString("ip");
            System.out.println(app + ip);
        } catch (ConfigurationException cex) {
            // Something went wrong
        }
    }*/
}